#ifndef TRIANGLES_H
#define TRIANGLES_H
#include<math.h>
#include <vector>
using std::vector;


class Coord
{
public:
    double x;
    double y;
    Coord():x(0),y(0){}
    Coord(const double& _x, const double& _y):x(_x),y(_y){}
};



class Segment
{
public:
    Coord c1,c2;
    Segment(Coord _c1,Coord _c2):c1(_c1),c2(_c2){}
    Segment():c1(Coord(0,0)),c2(Coord(1,1)){}
    Segment Subsegment(double Partsize,double Deviation);
    double Length();
    Coord InnerPoint(double Tau);
};

class Line
{
private:
    void SubConstr(Coord coo,double angle);
public:
    double a;
    double b;
    double c;
    Line(double _a, double _b, double _c):a(_a),b(_b),c(_c){}
    Line(Segment seg);
    Line(Coord coo,double angle);
    Line(Segment seg,double Tau,double angle);
    double Angle();
    double Y(double x);
    double X(double y);
};

Coord Intersection(Line l1,Line l2);

class Triangle
{
public:
    int width;
    Coord c1,c2,c3;
    Triangle(Coord _c1,Coord _c2,Coord _c3):c1(_c1),c2(_c2),c3(_c3),width(1){}
    Triangle(double Angle,Coord reppPoint,Segment Seg,int _width);
    Coord Center();
    vector<Segment> Borders();
    vector<Segment> FullBorders();
};

vector<Triangle> Fractal(int width,int height);


#endif // TRIANGLES_H
